<?php
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");

?>

<?

//接收需要修改的数据的id
$new_detail_nid            = addslashes($_REQUEST['nid']);

//传递过来的页面信息。返回的时候，会根据这些信息返回原来的页面
//统一设置一下保存图片的路径
$_uf['path'] = ROOT_PATH_ . "/uploadfiles/";

//上传icon
if (is_uploaded_file($_FILES['photo']['tmp_name'])) {
    $_uf['upfile']       = $_FILES['photo'];
    $_info               = upload_file($_uf);
    $_REQUEST['ai_photo'] = $_info['name'];
    $icon                = $_REQUEST['ai_photo'];

    $table        = $table_Prefix . "employee";
    $sql=update_date($table,$_REQUEST,"nid",$new_detail_nid);
    $query = mysql_query($sql) or die ($sql);
    mysql_close($con);

    ?>
    <script type="text/javascript">

    alert("输入信息已保存，点击确认返回继续操作.");
    document.location.href = "detail-reset-pw.php?nowpageid=<? echo $nowpageid ?>&sortby=<? echo $sortby?>&nid=<? echo $term_nid ?>&sys_part=<? echo $system_part ?>&nid=<? echo $new_detail_nid ?>"

    </script>
    <?
}

$detail=select_one_line_all_items($table_Prefix."employee","nid = '".$new_detail_nid."'");



$new_detail_root_password  = md5(addslashes($_REQUEST['root_password']));
$new_detail_new_password   = md5(addslashes($_REQUEST['new_password']));
$new_detail_renew_password = md5(addslashes($_REQUEST['renew_password']));


//传递过来的页面信息。返回的时候，会根据这些信息返回原来的页面
$nowpageid = addslashes($_REQUEST['nowpageid']);
$sortby    = addslashes($_REQUEST['sortby']);
$term_nid  = addslashes($_REQUEST['term_nid']);
?>


<?
//设置表格和默认排序
$table_suffix = "employee";
$table        = $table_Prefix . $table_suffix;



$sql = "update $table SET
mima           = '$new_detail_new_password'
where nid=$new_detail_nid";

// var_dump($new_detail_root_password);
// var_dump($new_detail_renew_password);
// exit;
if(
    ($detail['mima']!=$new_detail_root_password)||
    ($new_detail_new_password!=$new_detail_renew_password)
)
{

    ?>

    <script type="text/javascript">

    alert("更改密码失败");
        //document.location.href = "detail-reset-pw.php?nowpageid=<? echo $nowpageid ?>&sortby=<? echo $sortby?>&nid=<? echo $term_nid ?>&sys_part=<? echo $system_part ?>"

    </script>

    <?
}
else{
    $query = do_query($sql) or die (mysqli_error().mysqli_errno().'更新detail表product数据失败!');
    mysqli_close($con);
?>


<script type="text/javascript">
    alert("输入信息已保存，点击确认返回继续操作.");
    document.location.href = "detail-reset-pw.php?nowpageid=<? echo $nowpageid ?>&sortby=<? echo $sortby?>&nid=<? echo $term_nid ?>&sys_part=<? echo $system_part ?>&nid=<? echo $new_detail_nid ?>"
</script>
<?} ?>


